package com.yuyue.dronesystem.enums;

import java.util.Objects;

/**
 * PlaceType
 */
public enum PlaceType {
    OTHER(0,"其他"),
    HOSPITAL(1,"医院"),
    POST(2,"港口"),
    POPULATION(3,"人口密集点");

    private Integer code;
    private String value;

    PlaceType(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public Integer getCode() {
        return this.code;
    }

    public String getValue() {
        return this.value;
    }
    
    public static PlaceType fromValue(Integer code) {
        for (PlaceType placeType : PlaceType.values()) {
            if (Objects.equals(code, placeType.getCode())) {
                return placeType;
            }
        }
        throw new IllegalArgumentException();
    }
}